namespace XnaConnection.Components.Graphics
{
    #region Using statements

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Audio;
    using Microsoft.Xna.Framework.Content;
    using Microsoft.Xna.Framework.GamerServices;
    using Microsoft.Xna.Framework.Graphics;
    using Microsoft.Xna.Framework.Input;
    using Microsoft.Xna.Framework.Media;
    using Microsoft.Xna.Framework.Net;
    using Microsoft.Xna.Framework.Storage;

    #endregion

    /// <summary>
    /// This represent the base DrawableGameComponent for the game.
    /// </summary>
    public abstract class Base2DGameComponent : Microsoft.Xna.Framework.DrawableGameComponent
    {
        #region Fields

        /// <summary>
        /// Stores the class that will do the rendering.
        /// </summary>
        private SpriteBatch renderer;

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the Base2DDrawableGameComponent class.
        /// </summary>
        /// <param name="game">The game that will use this DrawableGameComponent.</param>
        public Base2DGameComponent(Game game)
            : base(game)
        {
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets the ContentManager that will provide assets loading functions
        /// </summary>
        public ContentManager Content
        {
            get { return this.Game.Content; }
        }

        /// <summary>
        /// Gets the SpriteBatch that will provide rendering functions
        /// </summary>
        public SpriteBatch Renderer
        {
            get { return this.renderer; }
        }

        #endregion

        #region Methods

        /// <summary>
        /// Load the component assets and graphics objects.
        /// </summary>
        protected override void LoadContent()
        {
            // Initializes the Sprite batch that will render 2D stuff on screen
            this.renderer = new SpriteBatch(this.GraphicsDevice);

            base.LoadContent();
        }

        #endregion
    }
}